﻿using System.Windows.Controls;
using ZFCNew.ViewModels;

namespace ZFCNew.Views
{
	/// <summary>
	/// Interaction logic for ImageGalleryxaml.xaml
	/// </summary>
	public partial class PhotoGallery : UserControl
	{
		public PhotoGallery()
		{
			this.InitializeComponent();
            Loaded += new System.Windows.RoutedEventHandler(PhotoGallery_Loaded);
			// Insert code required on object creation below this point.
		}

        void PhotoGallery_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            foreach (var child in ThumbHolder.Children)
            {
                child.MouseLeftButtonDown += Thumbnail_MouseLeftButtonDown;
            }
        }
        public void GoNext()
        {

        }

        private void Thumbnail_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            var context = (PhotoGalleryModel)this.LayoutRoot.DataContext;
            var s = (Thumbnail) sender;
            context.DisplayImage(int.Parse(s.Tag.ToString()));
        }

	}
}